<?php
/**
 * Created by PhpStorm.
 * User: wangye
 * Date: 19-2-14
 * Time: 下午8:50
 */
use Workerman\Worker;

require_once './Workerman/Autoloader.php';

//创建一个worker监听2345端口,使用http协议
$http_worker = new Worker("http://0.0.0.0:2345");

//启动4个进程对外提供服务
$http_worker->count = 4;

//接受到浏览器发送的数据及时回复hello world给浏览器
$http_worker->onMessage = function ($connection,$data)
{
  //向浏览器发送hello world
    $connection->send("Hello world");
};

//运行worker
Worker::runAll();